<?php

class Mac_Db_Clause_Join
{   
    private $left_op;
    private $type;
    private $right_op;
    private $on;
    
    private function __construct ($left_op, $type, $right_op, $on = null)
    {
        $this->left_op = $left_op;
        $this->right_op = $right_op;
        $this->type = $type;
        $this->on = $on;
    }
    
    public static function create ($left_op, $type, $right_op, $on = null)
    {
        if (($on !== null) && !($on instanceof Mac_Db_Clause_Where)) {
            throw new Mac_Db_Exception_Clause_Join_OnWrongType('on Clause has to be an instance of Mac_Db_Clause_Where');
        }
        return new static($left_op, $type, $right_op, $on);
    }
    
    public function __toString()
    {
        $str = $this->left_op.' '.$this->type.' '.$this->right_op;
        if ($this->on !== null) {
            $str .= ' ON '.$this->on;
        }
        return $str;
    }
    
    private function getTypeParameters($type)
    {
        
    }
}